﻿
set(CRASHPAD_FOUND "NO")

if (WIN32)
    include_directories(${PROJECT_ROOT}/libs/crashpad/win/include)
    include_directories(${PROJECT_ROOT}/libs/crashpad/win/include/mini_chromium)

    find_path(CRASHPAD_INCLUDE_DIR crashpad_client.h
        ${PROJECT_ROOT}/libs/crashpad/win/include
        ${PROJECT_ROOT}/libs/crashpad/win/include/mini_chromium
        )

    find_library(CRASHPAD_BASE_LIBRARY_RELEASE
        NAMES base
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/crashpad/win/lib/release
        )

    find_library(CRASHPAD_CLIENT_LIBRARY_RELEASE
        NAMES client
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/crashpad/win/lib/release
        )

    find_library(CRASHPAD_UTIL_LIBRARY_RELEASE
        NAMES util
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/crashpad/win/lib/release
        )

    find_library(CRASHPAD_BASE_LIBRARY_DEBUG
        NAMES base
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/crashpad/win/lib/debug
        )

    find_library(CRASHPAD_CLIENT_LIBRARY_DEBUG
        NAMES client
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/crashpad/win/lib/debug
        )

    find_library(CRASHPAD_UTIL_LIBRARY_DEBUG
        NAMES util
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/crashpad/win/lib/debug
        )

else(WIN32)
    include_directories(${PROJECT_ROOT}/libs/crashpad/mac/include)
    include_directories(${PROJECT_ROOT}/libs/crashpad/mac/include/mini_chromium)

    find_path(CRASHPAD_INCLUDE_DIR crashpad_client.h
        ${PROJECT_ROOT}/libs/crashpad/mac/include/client
        ${PROJECT_ROOT}/libs/crashpad/mac/include/mini_chromium
        )

    find_library(CRASHPAD_BASE_LIBRARY_RELEASE
        NAMES base
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/crashpad/mac/lib
        )

    find_library(CRASHPAD_CLIENT_LIBRARY_RELEASE
        NAMES client
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/crashpad/mac/lib
        )

    find_library(CRASHPAD_UTIL_LIBRARY_RELEASE
        NAMES util
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/crashpad/mac/lib
        )

    find_library(CRASHPAD_BASE_LIBRARY_DEBUG
        NAMES base
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/crashpad/mac/lib
        )

    find_library(CRASHPAD_CLIENT_LIBRARY_DEBUG
        NAMES client
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/crashpad/mac/lib
        )

    find_library(CRASHPAD_UTIL_LIBRARY_DEBUG
        NAMES util
        PATH_SUFFIXES lib
        HINTS ${PROJECT_ROOT}/libs/crashpad/mac/lib
        )


endif(WIN32)


if (CRASHPAD_INCLUDE_DIR AND
        CRASHPAD_BASE_LIBRARY_RELEASE AND CRASHPAD_CLIENT_LIBRARY_RELEASE AND CRASHPAD_UTIL_LIBRARY_RELEASE AND
        CRASHPAD_BASE_LIBRARY_DEBUG AND CRASHPAD_CLIENT_LIBRARY_DEBUG AND CRASHPAD_UTIL_LIBRARY_DEBUG)
    set(CRASHPAD_FOUND "YES")
endif ()
